import type { Dispatch } from 'redux';

export interface State {
  list: any[]; // 窗口名称数据
  stationIdList: string[]; // 交易单元id
  cardListData: CardDataType[]; // 卡片数据
  titleInfo: {}; // 标题信息
}

export interface SearchDataType {
  windowsNameSel: number | undefined;
  windowSetVisible: boolean;
  addVisible: boolean;
  windowName: string | null;
  modelTitle: string;
  stationIds: string[];
  init: boolean;
}

export interface Payload {
  type: string;
  payload?: any;
}

export interface ApiResponse {
  statusCode: string;
  data?: any;
  message?: string;
  result: string;
}

export interface ListingTransactionDeclarationType extends State {
  menuCode: string;
  userName: string;
  buttonPermissions: string[];
  titleInfo: TitleInfo;
  windowNameLength: number;
  dispatch: Dispatch;
}

export interface TitleInfo {
  minDeclareElectricty: string; // 最小申报电量
  contractPriceLimit: number; // 合约价格上限
  contractPriceLowerLimit: number; // 合约价格下限
  spotOperatingDay: string; // 现货运行日
  minCapacity: string; // 最小电量
  minEletricPrice: string; // 最小电价
  tradedElectricity: string; // 成交电量
  listingElectricity: string; // 挂牌电量
  proxy: boolean; // 代理
}

export interface CardDataType {
  id: number;
  scenarioName: string; // 名子
  tradeLimit: string; // 交易上限
  tradedElectricity: string; // 已成交电量
  listingElectricity: string; // 挂牌电量
  surplusTradeLimit: string; // 剩余可交易上限
  dealNum: string; // 可成交笔数
  dealAvgPrice: string; // 成交均价
  marketId: string; // 交易单元id
  stationName: string; // 交易单元名称
  markDate: string; // 标的日期范围
  reportTime: string; // 交易申报时间
  quantityRange: string; // 电量范围
  priceRange: string; // 价格范围
  totalDelisted: string; // 摘牌总量
  statusDesc: string; // 状态
}

interface ListingDataType {
  minQuantity?: number;
  maxQuantity?: number;
  minPrice?: number;
  maxPrice?: number;
  totalDelisted?: number;
}

export interface SaveWinDataType {
  marketId: string;
  dynamicFields: {
    windowId: number;
    windowName?: string;
    startMarkDate: string;
    endMarkDate: string;
    reportDate: string;
    startReportTime: string;
    endReportTime: string;
  };
}

export interface SaveListingDataType extends ListingDataType {
  marketId?: string;
  dynamicFields: {
    // [key: string]: string | number | undefined;
    windowId?: number;
    planId?: number;
    operationType: number; // 1保存 2编辑 3删除
    stationIds?: string[];
  };
}

export interface QueryListingDataType {
  marketId: string;
  stationIds: string[];
  windowId: number;
}
